using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace UwinEducation.Domain.Entities
{
    /// <summary>
    /// 教师实体
    /// </summary>
    [Table("basic_teachers")]
    public class Teacher : EntityBase
    {
        public Guid Id { get;  set; }

        /// <summary>
        /// 工号
        /// </summary>
        public string TeacherNo { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 电话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; }

        public string FirstName { get; set; }
        public string Surname { get; set; }
        public string ABN { get; set; }
        public string TFN { get; set; }
        public string HomeAddress { get; set; }
        public string DOB { get; set; }
        public string BackupTFN { get; set; }
        public string BankDetail { get; set; }
        public string WWCCNumber { get; set; }
        public DateTime? ExpireDate { get; set; }

        public string? AccountNumber { get; set; }
        /// <summary>
        /// 1V1单价
        /// </summary>
        public decimal? OneToOnePrice { get; set; }
        /// <summary>
        /// 1v2单价
        /// </summary>
        public decimal? OneToTwoPrice { get; set; }
        /// <summary>
        /// 1v3单价
        /// </summary>
        public decimal? OneToThreePrice { get; set; }
        /// <summary>
        /// 1v4单价
        /// </summary>
        public decimal? OneToFourPrice { get; set; }
        /// <summary>
        /// 1v5单价
        /// </summary>
        public decimal? OneToFivePrice { get; set; }
        /// <summary>
        /// 1v6单价
        /// </summary>
        public decimal? OneToSixPrice { get; set; }

        /// <summary>
        /// 创建教师
        /// </summary>
        public static Teacher Create(
            string teacherNo,
            string name,
            string phone,
            string email,
            string remarks,
            string firstName,
            string surname,
            string abn,
            string tfn,
            string homeAddress,
            string dob,
            string backupTFN,
            string bankDetail,
            string wwccNumber,
            DateTime? expireDate,
            string? accountNumber,
            decimal? oneToOnePrice,
            decimal? oneToTwoPrice,
            decimal? oneToThreePrice,
            decimal? oneToFourPrice,
            decimal? oneToFivePrice,
            decimal? oneToSixPrice
        )
        {
            var teacher = new Teacher
            {
                Id = Guid.NewGuid(),
                TeacherNo = teacherNo,
                Name = name,
                Phone = phone,
                Email = email,
                Remarks = remarks,
                FirstName = firstName,
                Surname = surname,
                ABN = abn,
                TFN = tfn,
                HomeAddress = homeAddress,
                DOB = dob,
                BackupTFN = backupTFN,
                BankDetail = bankDetail,
                WWCCNumber = wwccNumber,
                CreatedAt = DateTime.Now,
                AccountNumber = accountNumber,
                OneToOnePrice = oneToOnePrice,
                OneToTwoPrice = oneToTwoPrice,
                OneToThreePrice = oneToThreePrice,
                OneToFourPrice = oneToFourPrice,
                OneToFivePrice = oneToFivePrice,
                OneToSixPrice = oneToSixPrice
            };
            
            // 只有当 expireDate 有值时才设置
            if (expireDate.HasValue)
            {
                teacher.ExpireDate = expireDate;
            }
            
            return teacher;
        }
    }
}
